sysroot: Strengthen several `g_return_if_fail` into `g_assert()`
authorColin Walters <walters@verbum.org>
Mon, 16 May 2022 14:59:27 +0000 (10:59 -0400)
committerColin Walters <walters@verbum.org>
Mon, 16 May 2022 15:00:08 +0000 (11:00 -0400)
Similar to prior changes; motivated by testing out an updated
`gcc -fanalyzer`.

src/libostree/ostree-sysroot.c

index 12feb195eef5f5793f2bb37e813683928dd37e5a..bcb55e55504721fc560e75fe745fb19abf95ad8a 100644 (file)
@@ -1267,7 +1267,7 @@ ostree_sysroot_get_booted_deployment (OstreeSysroot       *self)
 OstreeDeployment *
 ostree_sysroot_require_booted_deployment (OstreeSysroot *self, GError **error)
 {
-  g_return_val_if_fail (self->loadstate == OSTREE_SYSROOT_LOAD_STATE_LOADED, NULL);
+  g_assert (self->loadstate == OSTREE_SYSROOT_LOAD_STATE_LOADED);
 
   if (!self->booted_deployment)
     return glnx_null_throw (error, "Not currently booted into an OSTree system");
@@ -1286,7 +1286,7 @@ ostree_sysroot_require_booted_deployment (OstreeSysroot *self, GError **error)
 OstreeDeployment *
 ostree_sysroot_get_staged_deployment (OstreeSysroot       *self)
 {
-  g_return_val_if_fail (self->loadstate == OSTREE_SYSROOT_LOAD_STATE_LOADED, NULL);
+  g_assert (self->loadstate == OSTREE_SYSROOT_LOAD_STATE_LOADED);
 
   return self->staged_deployment;
 }
@@ -1300,7 +1300,7 @@ ostree_sysroot_get_staged_deployment (OstreeSysroot       *self)
 GPtrArray *
 ostree_sysroot_get_deployments (OstreeSysroot  *self)
 {
-  g_return_val_if_fail (self->loadstate == OSTREE_SYSROOT_LOAD_STATE_LOADED, NULL);
+  g_assert (self->loadstate == OSTREE_SYSROOT_LOAD_STATE_LOADED);
 
   GPtrArray *copy = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
   for (guint i = 0; i < self->deployments->len; i++)
@@ -1525,7 +1525,7 @@ ostree_sysroot_query_deployments_for (OstreeSysroot     *self,
                                       OstreeDeployment  **out_pending,
                                       OstreeDeployment  **out_rollback)
 {
-  g_return_if_fail (osname != NULL || self->booted_deployment != NULL);
+  g_assert (osname != NULL || self->booted_deployment != NULL);
   g_autoptr(OstreeDeployment) ret_pending = NULL;
   g_autoptr(OstreeDeployment) ret_rollback = NULL;